package com.tech.connect.api;


import com.ksy.common.utils.CommonApiUtils;
import com.tech.connect.model.CatChoose;
import com.tech.connect.model.CatOpt;
import com.tech.connect.model.ItemCatSub;
import com.tech.connect.model.ItemFuWu;
import com.tech.connect.model.KeyWord;
import com.tech.connect.model.OptChoose;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.POST;

/**
 * Created by Ksy
 */

public class FuWuHttp extends CommonApiUtils {
    public static Map<String, Object> getMap() {
        return new HashMap<>();
    }

    public interface ConnectApiServer {
        @POST("v1/service/conditions")
        Observable<BaseEntity<Map<String, List<ItemCatSub>>>> optChooseList();

        @POST("dictionary/service-category")
        Observable<BaseEntity<List<CatChoose>>> catChooseList();

        @POST("keyword/service-keyword")
        Observable<BaseEntity<List<KeyWord>>> keyWord();

        @POST("v1/service/units")
        Observable<BaseEntity<Map<String, List<OptChoose>>>> catUnitList();

        @POST("dictionary/service-category-properties")
        Observable<BaseEntity<List<CatOpt>>> catOptList(@Body Map<String, Object> map);

        @POST("v1/service/create")
        Observable<BaseEntity<String>> create(@Body Map<String, Object> map);

        @POST("v1/service/list")
        Observable<BaseEntity<List<ItemFuWu>>> list(@Body Map<String, Object> map);

        @POST("v1/service/create-order")
        Observable<BaseEntity<String>> createOrder(@Body Map<String, Object> map);

        @POST("v1/service/add-browse-times")
        Observable<BaseEntity<Map<String, String>>> view(@Body Map<String, Object> map);
    }

    public static Observable<BaseEntity<String>> createOrder(Map<String, Object> map, final BaseEntityOb<String> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).createOrder(map));
    }

    public static Observable<BaseEntity<Map<String, String>>> view(Map<String, Object> map, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).view(map));
    }

    public static Observable<BaseEntity< String>> create(Map<String, Object> map, final BaseEntityOb<String> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).create(map));
    }

    public static Observable<BaseEntity<Map<String, List<ItemCatSub>>>> optChooseList(final BaseEntityOb<Map<String, List<ItemCatSub>>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).optChooseList());
    }

    public static Observable<BaseEntity<List<CatChoose>>> catChooseList(final BaseEntityOb<List<CatChoose>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).catChooseList());
    }

    public static Observable<BaseEntity<List<ItemFuWu>>> list(Map<String, Object> map, final BaseEntityOb<List<ItemFuWu>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).list(map));
    }

    public static Observable<BaseEntity<List<KeyWord>>> keyWord(final BaseEntityOb<List<KeyWord>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).keyWord());
    }

    public static Observable<BaseEntity<List<CatOpt>>> catOptList(Map<String, Object> map, final BaseEntityOb<List<CatOpt>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).catOptList(map));
    }

    public static Observable<BaseEntity<Map<String, List<OptChoose>>>> catUnitList(final BaseEntityOb<Map<String, List<OptChoose>>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).catUnitList());
    }


}
